package com.xplay.xpocker.room.mahjong.settlement;

import com.xplay.xpocker.constant.ConstantDict;
import com.xplay.xpocker.constant.MessageNoticeEnum;
import com.xplay.xpocker.constant.RoomTypeEnum;
import com.xplay.xpocker.dvo.AbstractRoom;
import com.xplay.xpocker.dvo.GameRuMahjongUserState;
import com.xplay.xpocker.entity.*;
import com.xplay.xpocker.room.RoomInfoTL;
import com.xplay.xpocker.room.mahjong.AbstractIsolationEventStrategy;
import com.xplay.xpocker.room.mahjong.MahjongConfigProp;
import com.xplay.xpocker.room.mahjong.constant.MKey;
import com.xplay.xpocker.room.mahjong.constant.PbTypeEnum;
import com.xplay.xpocker.room.mahjong.dto.*;
import com.xplay.xpocker.room.mahjong.event.UserEvent;
import com.xplay.xpocker.room.mahjong.util.MahjongHuUtil;
import com.xplay.xpocker.room.message.MessageContent;
import com.xplay.xpocker.room.message.MessageContentFactory;
import com.xplay.xpocker.room.message.MessageToClient;
import com.xplay.xpocker.room.message.MessageType;
import com.xplay.xpocker.service.GameRuMahjongLogsService;
import com.xplay.xpocker.util.CardUtil;
import com.xplay.xpocker.util.ObjectUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.stream.Collectors;

@Slf4j
@Component
public class CdIsolationEvent extends AbstractIsolationEventStrategy {


    @Autowired
    private GameRuMahjongLogsService userRuActionLogService;

    @Override
    protected RoomTypeEnum strategyName() {
        return null;
    }


    @Override
    public void settlementBar(GameRuMahjongUserState currentUser, GameRuMahjongUserState exportUser, Integer type, Integer card, AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo) {
    }

    @Override
    public void settlementHu(GameRuMahjongUserState currentUser, GameRuMahjongUserState exportUser, Integer exportCard, AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo) {

    }

    @Override
    public void presentSettlement(AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo, GameHiRoomDTO gameHiRoomDTO) {

    }

    @Override
    public ScoreInfo checkHu(GameRuMahjongUserState currentUser, GameRuMahjongUserState exportUser, Integer card, AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo) {
        return null;
    }

    /**
     * 开始出牌  事件检测
     */
    public void gameStartActionCheck(AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo) {

    }
    /**
     *
     *
     * -- 距离最新一次摸牌   这个时间内 是否存在   碰牌 + PASS
     * select * from game_ru_mahjong_logs b where b.id >
     * (SELECT min(id) FROM `game_ru_mahjong_logs` a where a.source_user_id = 1 and a.source_user_id = b.source_user_id and a.action = 'TOUCH')
     * and (b.action = 'BUMP' or b.action = 'TOUCH')
     *
     */

    /**
     * 发牌事件检测
     */
    public void dealCardActionCheck(GameRuMahjongUserState nextUser, Integer nextCard, AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo) {

    }

    /**
     * 是否缺一门 missingOne
     * 是否定雀   isConfirm
     * 是否幺鸡   yaoChicken
     * 是否小胡不走
     *
     * @param currentUser
     * @return
     */

    @Override
    public List<EFScoreInfo> checkListenCards(GameRuMahjongUserState currentUser, AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo) {
        return null;
    }

    @Override
    public List<MahjongHuUtil.CardEHInfo> checkExportListenCards(GameRuMahjongUserState currentUser) {
        return null;
    }

    /**
     * 出牌     事件检测
     * 记录一下 别人  碰  杠  胡
     */
    public boolean exportCardActionCheck(GameRuMahjongUserState current, Integer exportCard, AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo) {

        return false;
    }

    /**
     * 判断两个集合是否相等
     *
     * @param list1
     * @param list2
     * @return
     */

    public static boolean areListsEqual(List<Integer> list1, List<Integer> list2) {
        return false;
    }

    /***
     * 当用户移出这张牌过后   也就是报听是否可以杠牌
     * 是否影响报听
     * @param userDTO
     * @param cardCode
     * @return
     */

    public boolean checkListenUserBar(GameRuMahjongUserState userDTO, Integer cardCode) {

        return false;

    }

    /**
     * 碰牌     事件检测
     */
    public void bumpCardActionCheck(AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo, GameRuMahjongUserState current, GameRuMahjongUserState source, Integer cardCode) {

    }

    /**
     * 杠牌     事件检测
     */
    public void userBarActionCheck() {
    }

    @Override
    public void checkUserAction(AbstractRoom<MahjongRoomRule, MahjongRoomInfo, GameRuMahjongLogs> roomInfo) {

    }

}
